package com.wbt.bambootown.mvp.presenter;


import com.wbt.bambootown.entity.CameraPic;
import com.wbt.bambootown.entity.ControlDevices;
import com.wbt.bambootown.mvp.contract.CameraPicContract;
import com.wbt.bambootown.mvp.contract.ControlDevicesContract;
import com.wbt.bambootown.mvp.frame.ActivityPresenter;
import com.wbt.bambootown.mvp.frame.FragmentPresenter;
import com.wbt.bambootown.mvp.model.CameraPicModel;
import com.wbt.bambootown.mvp.model.ControlDevicesModel;
import com.wbt.bambootown.rx.FilterSubscriber;

import java.util.List;

public class ControlDevicesPresenter extends FragmentPresenter<ControlDevicesModel,ControlDevicesContract.View> implements ControlDevicesContract.Presenter{
    public static final String TAG = "ControlDevicesPresenter";

    @Override
    public void getControlDevices(int id) {
        addSubscription(getModel().getControlDevices(id), new FilterSubscriber<List<ControlDevices>>() {
            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().showError(errorMsg);
            }

            @Override
            public void onNext(List<ControlDevices> controlDevices) {
                getView().showDevicesSuccess(controlDevices);
            }
        });
    }
}
